package com.hdl;

import com.hdl.service.UserService;
import com.hdl.service.impl.UserServiceImpl;
import com.hdl.utils.BeanFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author Administrator
 */
@EnableAutoConfiguration
@ComponentScan(basePackages = {"com.hdl"})
public class ServerBootstrap {
    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ServerBootstrap.class);

        String hostname = applicationContext.getEnvironment().getProperty("netty.server.hostname");
        String port = applicationContext.getEnvironment().getProperty("netty.server.port");
        // 启动netty
        UserServiceImpl.startServer(hostname, Integer.parseInt(port));
    }
}